package com.changhai.diabetes.service.impl;

import com.changhai.diabetes.model.InterPatientGroup;
import com.changhai.diabetes.service.InterPatientGroupService;
import com.changhai.diabetes.util.Constants;

/**
 * 科研分组信息
 * 
 * @author Andy
 * 
 */
public class InterPatientGroupServiceImpl extends CommonServiceImpl implements InterPatientGroupService {

	public InterPatientGroup getGroupByPatientId(Long patientId) {
		InterPatientGroup ipg = new InterPatientGroup();
		if (patientId != null && patientId > 0) {
			ipg = (InterPatientGroup) this.getObject(Constants.DS_CHANGHAI, "interPatientGroup.getByPatientId",
					patientId);
		}
		return ipg;
	}

	public void savePatientGroup(InterPatientGroup interPatientGroup) {
		if (interPatientGroup != null) {
			this
					.updateObject(Constants.DS_CHANGHAI, "interPatientGroup.updateByPrimaryKeySelective",
							interPatientGroup);
		}
	}

	public Long saveNewPatientGroup(InterPatientGroup interPatientGroup) {
		Integer seqId = 0;
		if (interPatientGroup != null) {
			seqId = this.insertObjectID(Constants.DS_CHANGHAI, "interPatientGroup.insert", interPatientGroup);
		}
		return new Long(seqId);
	}
}
